package STUDENT.TRANNGUYENQUAN.OOPs.OBJECT_AND_CLASSES.Triangle;

import java.util.Scanner;

public class Views {
	public static void main(String[] args) {
		String numA = "";
		String numB = "";
		String numC = "";
		Triangle tri = new Triangle();
		Models model = new Models();
		TriangleControllers controller = new TriangleControllers();
		Scanner sc;
		do {
			System.out.println("Nhap vao canh thu nhat cua tam giac:");
			sc = new Scanner(System.in);
			String temp = sc.nextLine();
			if (temp.isEmpty()) {
				System.out.println("Ban chua nhap canh thu nhat!");
			} else {
				numA = temp;
			}
		} while (numA.isEmpty());
		do {
			System.out.println("Nhao vao canh thu hai cua tam giac:");
			sc = new Scanner(System.in);
			String temp = sc.nextLine();
			if (temp.isEmpty()) {
				System.out.println("Ban chua nhap vao canh thu hai!");
			} else {
				numB = temp;
			}
		} while (numB.isEmpty());
		do {
			System.out.println("Nhao vao canh thu ba cua tam giac:");
			sc = new Scanner(System.in);
			String temp = sc.nextLine();
			if (temp.isEmpty()) {
				System.out.println("Ban chua nhap vao canh thu ba!");
			} else {
				numC = temp;
			}
		} while (numC.isEmpty());
		tri.setSide1(Double.parseDouble(numA));
		tri.setSide2(Double.parseDouble(numB));
		tri.setSide3(Double.parseDouble(numC));
		if (controller.Check(tri)) {
			System.out.println("Canh 1=" + tri.getSide1() + " ,Canh 2=" + tri.getSide2() + " ,Canh 3=" + tri.getSide3());
			System.out.println("Chu vi cua hinh tam giac la: " + model.Perimeter(tri));
			System.out.println("Dien tich cua hinh tam giac la: " + model.Area(tri));
		} else {
			System.out.println("Ban nhap vao gia tri cua cac canh chua dung, gia tri cua cac canh phai lon hon hoac bang 1!");
		}
	}
}
